package cn.tlb.retrofit.local_get;

import android.test.AndroidTestCase;
import android.util.Log;

import cn.tlb.Constants;
import retrofit.Call;
import retrofit.Callback;
import retrofit.GsonConverterFactory;
import retrofit.Response;
import retrofit.Retrofit;

/**
 * Created by 汤林冰 on 2015/12/21 10:39.
 */
public class LocalTest extends AndroidTestCase {
    private static final String TAG = LocalTest.class.getSimpleName();
    public void test1(){
        Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Constants.LOCAL_HOST)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
        LocalService localService = retrofit.create(LocalService.class);
        Call<User> userCall = localService.getUser("get");
        userCall.enqueue(new Callback<User>() {
            @Override
            public void onResponse(Response<User> response, Retrofit retrofit) {
                Log.i(TAG, response.body().toString());
            }

            @Override
            public void onFailure(Throwable t) {
                Log.i(TAG, "onFailure: "+t);
            }
        });

    }
}
